package com.ddtech.business.practice.controller;

import com.ddtech.business.practice.query.PracticeVrRecordQuery;
import com.ddtech.business.practice.service.PracticeVrRecordService;
import com.ddtech.business.practice.vo.PracticeVrRecordReqVo;
import com.ddtech.framework.log.aop.log.Log;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @version v1.0
 * @ClassName:PracticeVrRecordController description：
 * @author:wei_zhang(xiao)
 * @date: 2024-07-16 22:45
 */
@Api(tags = "VR训练记录")
@RestController
@RequestMapping("/practiceVrRecord")
public class PracticeVrRecordController {

    @Autowired
    private PracticeVrRecordService practiceVrRecordService;

    @Log("成绩上传VR")
    @ApiOperation(value = "成绩上传VR")
    @PostMapping(value = "/gradeSave")
    public ResponseEntity gradeSave(@RequestBody PracticeVrRecordReqVo practiceVrRecordReqVo) {
        practiceVrRecordService.gradeSave(practiceVrRecordReqVo);
        return new ResponseEntity(true, HttpStatus.OK);
    }

    @ApiOperation(value = "学生账号查询训练记录列表")
    @GetMapping(value = "/pageList")
    public ResponseEntity getPageList(PracticeVrRecordQuery practiceVrRecordQuery) {
        return new ResponseEntity(practiceVrRecordService.pageList(practiceVrRecordQuery), HttpStatus.OK);
    }

    @ApiOperation(value = "查询训练详情，柱状图")
    @GetMapping(value = "/practiceDetail/{id}")
    public ResponseEntity practiceDetail(@PathVariable String id) {
        return new ResponseEntity(practiceVrRecordService.practiceDetail(id), HttpStatus.OK);
    }

    @ApiOperation(value = "训练回放记录查询，管理员、老师全部，学生查询自己")
    @GetMapping(value = "/pageListByCode")
    public ResponseEntity practiceDetail(PracticeVrRecordQuery practiceVrRecordQuery) {
        return new ResponseEntity(practiceVrRecordService.pageListCode(practiceVrRecordQuery), HttpStatus.OK);
    }
}
